package localizer.main;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.util.SparseBooleanArray;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ListView;
import android.widget.Toast;

public class MenuConfigMsgListView extends Activity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.list_confg_msg);
		final ListView lv = (ListView) findViewById(R.id.lsv_config_msg);
		
		final String lv_items[] = { "Audio/Visual by SMS Alert","Send Localization by SMS"};
		ArrayList<String> lis = new ArrayList<String>();
		lis.add("Audio/Visual by SMS Alert");
		lis.add("Send Localization by SMS");
		lv.setAdapter(new CheckedArrayAdapter(this, lis));
		lv.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
					CheckBox c = (CheckBox) arg1.findViewById(R.id.CheckBox01);
					c.setChecked(!c.isChecked());
					if(arg2==0){
						Config.getInstance(MenuConfigMsgListView.this).setEnableCheckRingByMsg(MenuConfigMsgListView.this
								,c.isChecked());
						if(c.isChecked()){
							Toast.makeText(MenuConfigMsgListView.this, "Ring By SMS is Enable",Toast.LENGTH_LONG).show();
						}else{
							Toast.makeText(MenuConfigMsgListView.this, "Ring By SMS is Disabled",Toast.LENGTH_LONG).show();
						}
					}else{
						Config.getInstance(MenuConfigMsgListView.this).setEnableCheckLocByMsg(MenuConfigMsgListView.this
								,c.isChecked());
						if(c.isChecked()){
							Toast.makeText(MenuConfigMsgListView.this, "Localization By SMS is Enable",Toast.LENGTH_LONG).show();
						}else{
							Toast.makeText(MenuConfigMsgListView.this, "Localization By SMS is Disabled",Toast.LENGTH_LONG).show();
						}
					}
			    }
			
		});
	}

}


